package com.tencent.bugly.beta.upgrade;

import android.support.v4.view.PointerIconCompat;
import android.text.TextUtils;
import com.tencent.bugly.beta.global.e;
import com.tencent.bugly.proguard.ah;
import com.tencent.bugly.proguard.aj;
import com.tencent.bugly.proguard.ak;
import com.tencent.bugly.proguard.an;
import com.tencent.bugly.proguard.bh;
import com.tencent.bugly.proguard.m;
import com.tencent.bugly.proguard.x;
import java.util.HashMap;
import java.util.Map;

/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class b {
    public static b a = new b();

    /* JADX INFO: Access modifiers changed from: protected */
    public synchronized void a(int i, byte[] bArr, a aVar, boolean z, String str) {
        com.tencent.bugly.crashreport.common.info.a b = com.tencent.bugly.crashreport.common.info.a.b();
        try {
        } catch (Throwable th) {
            th = th;
        }
        try {
            bh a2 = ah.a(e.E.s, i, bArr);
            if (a2 != null) {
                e eVar = e.E;
                a2.b = eVar.u;
                if (!TextUtils.isEmpty(eVar.P)) {
                    a2.e = eVar.P;
                }
                if (a2.k != null) {
                    a2.k.put("G6", eVar.v);
                    a2.k.put("G10", "1.4.1");
                    Map<String, String> map = a2.k;
                    map.put("G3", "" + eVar.x);
                    a2.k.put("G11", String.valueOf(eVar.w));
                    Map<String, String> map2 = a2.k;
                    map2.put("G7", "" + b.m());
                    Map<String, String> map3 = a2.k;
                    map3.put("G8", "" + b.k());
                    Map<String, String> map4 = a2.k;
                    map4.put("G9", "" + b.l());
                    a2.k.put("G2", String.valueOf(com.tencent.bugly.beta.global.a.a(e.E.s)));
                    a2.k.put("G12", String.valueOf(eVar.o));
                    Map<String, String> map5 = a2.k;
                    map5.put("A21", "" + b.g());
                    Map<String, String> map6 = a2.k;
                    map6.put("A22", "" + b.h());
                    Map<String, String> map7 = a2.k;
                    map7.put("G13", "" + eVar.J);
                    Map<String, String> map8 = a2.k;
                    map8.put("G14", "" + eVar.K);
                    Map<String, String> map9 = a2.k;
                    map9.put("G15", "" + eVar.M);
                    Map<String, String> map10 = a2.k;
                    map10.put("G17", "" + b.x());
                    Map<String, String> map11 = a2.k;
                    map11.put("C01", "" + b.H());
                    Map<String, String> map12 = a2.k;
                    map12.put("G18", "" + b.g());
                    Map<String, String> B = b.B();
                    if (B != null && B.size() > 0) {
                        for (Map.Entry<String, String> entry : B.entrySet()) {
                            Map<String, String> map13 = a2.k;
                            map13.put("C03_" + entry.getKey(), entry.getValue());
                        }
                    }
                    an.c("app version is: [%s.%s], [deviceId:%s], channel: [%s], base tinkerId:[%s], patch tinkerId:[%s], patch version:[%s]", eVar.x, Integer.valueOf(eVar.w), b.h(), a2.e, eVar.J, eVar.K, eVar.M);
                    HashMap hashMap = new HashMap();
                    hashMap.put("grayStrategyUpdateTime", e.E.F.b + "");
                    if (z) {
                        ak.a().a(PointerIconCompat.TYPE_HAND, a2.g, ah.a((Object) a2), str, str, aVar, 0, 1, true, hashMap);
                    } else {
                        ak.a().a(PointerIconCompat.TYPE_HAND, a2.g, ah.a((Object) a2), str, str, (aj) aVar, false, (Map<String, String>) hashMap);
                    }
                }
            }
        } catch (Throwable th2) {
            th = th2;
            if (!an.a(th)) {
                th.printStackTrace();
            }
            aVar.a(i, null, 0L, 0L, false, "sendRequest failed");
        }
    }

    public synchronized void a(x xVar, boolean z) {
        if (xVar == null) {
            return;
        }
        try {
            a(803, ah.a((m) xVar), new a(2, 803, xVar, Boolean.valueOf(z)), false, e.E.F.a.d);
        } catch (Throwable th) {
            if (!an.b(th)) {
                th.printStackTrace();
            }
        }
    }
}
